﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace Enterprise.Base
{
    /// <summary>
    /// Attribute specified on a <see cref="IPropertyMappingProvider"/>
    /// indicating the type of property that it maps
    /// </summary>
    [AttributeUsage(AttributeTargets.Class)]
    public class MappingPropertyTypeNameAttribute : System.Attribute
    {
        private string _propertyTypeName;
        public MappingPropertyTypeNameAttribute(string propertyTypeName)
        {
            _propertyTypeName = propertyTypeName;
        }
        public string PropertyTypeName
        {
            get
            {
                return _propertyTypeName;
            }

        }
    }
    /// <summary>
    /// Responsible for mapping String Values between both properties
    /// </summary>
    [MappingPropertyTypeName("System.String")]
    internal class StringPropertyMappingProvider : PropertyMappingProviderBase
    {
        /// <summary>
        /// Map String Values
        /// </summary>
        /// <param name="entity">Entity received from the client code,
        /// <see cref="System.Object"/></param>
        /// <param name="LINQEntity">Entity retrieved from DB</param>
        /// <param name="LINQProperty">
        /// <see cref="System.Reflection.PropertyInfo"/> from LINQ entity
        /// retrieved from DB to be mapped</param>
        public override void MapProperties(object entity,
                        object LINQEntity, PropertyInfo LINQProperty)
        {
            base.MapProperties(entity, LINQEntity, LINQProperty);
        }
    }
    /// <summary>
    /// Responsible for mapping Value types between both properties
    /// </summary>
    [MappingPropertyTypeName("System.ValueType")]
    internal class ValueTypePropertyMappingProvider : PropertyMappingProviderBase
    {
        /// <summary>
        /// Map Value types
        /// </summary>
        /// <param name="entity">Entity received from the
        /// client code, <see cref="System.Object"/></param>
        /// <param name="LINQEntity">Entity retrieved from DB</param>
        /// <param name="LINQProperty">
        /// <see cref="System.Reflection.PropertyInfo"/> from LINQ entity
        /// retrieved from DB to be mapped</param>
        public override void MapProperties(object entity,
                        object LINQEntity, PropertyInfo LINQProperty)
        {
            base.MapProperties(entity, LINQEntity, LINQProperty);
        }
    }
}
